Documentation
Color Maze
Thank you so much for purchasing our item from codecanyon.
- Version: 1.0
- Author: demonisblack
- Created: 14 Sep, 2024
- Update: -
If you have any questions that are beyond the scope of this help file, Please feel free to email via Item Support Page.
Overview
Color Maze is a HTML5 game where you have to move the paintball and paint all of the maze, fill the entire maze to move on to the next level.
The ZIP package contains the game with 1280×768 and 768×1024 resolution that scales proportionally to fit current screen device.

Installation
Follow the steps below to setup your game:
- To install the game just upload folder /game to your hosting web server using FTP or localhost in order to use it on your website. The game won't run locally with some browser like Chrome due to some security mode.
- Below is the folder structure and needs to be uploaded to your website or localhost root directory:
game/assets- Images & audio filesgame/css- Stylesheet filesgame/js- Javacript filesgame/edit.html- Built-in Editor pagegame/editTools.html- Built-in Editor Toolgame/icon.ico- Website icongame/share.jpg- Social share imagegame/share.php- Social share filegame/index.html- Homepage
- You will need a website that runs PHP to make facebook share button work, and make sure to change Facebook Open Graph meta and Twitter meta in index.html, just replace
[GAME_URL]to your game URL.
<!-- for Facebook -->
<meta property="og:image" content="[GAME_URL]/share.jpg" />
<meta property="og:url" content="[GAME_URL]" />
<!-- for Twitter -->
<meta name="twitter:image" content="[GAME_URL]/share.jpg" />
Settings
Follow the steps below to customize your game:
You can easily customize game text and settings in game.js file
//theme settings
var themeSettings = [
{
floor:'assets/item_floo_off_1.png',
colors:[
{fill:"#B10000", image:'assets/balls/balls_1_1.png', floor:'assets/item_floo_on_1.png'},
{fill:"#13A800", image:'assets/balls/balls_1_2.png', floor:'assets/item_floo_on_1.png'},
{fill:"#8516B7", image:'assets/balls/balls_1_3.png', floor:'assets/item_floo_on_1.png'},
{fill:"#1C86C7", image:'assets/balls/balls_1_4.png', floor:'assets/item_floo_on_1.png'},
{fill:"#CC7700", image:'assets/balls/balls_1_5.png', floor:'assets/item_floo_on_1.png'},
{fill:"#CCC111", image:'assets/balls/balls_1_6.png', floor:'assets/item_floo_on_1.png'},
{fill:"#BC0093", image:'assets/balls/balls_1_7.png', floor:'assets/item_floo_on_1.png'},
{fill:"#00ABAF", image:'assets/balls/balls_1_8.png', floor:'assets/item_floo_on_1.png'},
]
}
]
//game settings
var gameSettings = {
blockSize:50,
pathColor:'#A3A3A3',
blockColor:'#fff',
sideColor:'#E2E2E2',
sideHeight:10,
trailColor:'#fff',
trailAlpha:.5,
trailSpeed:.5,
moveSpeed:.2,
keyboard:{ //keyboard code
left:[37,65],
right:[39,68],
up:[38,87],
down:[40,83],
}
};
//game text display
var textDisplay = {
selectLevel:'SELECT LEVEL',
exitTitle:'EXIT GAME',
exitMessage:'ARE YOU SURE\nYOU WANT TO\nQUIT GAME?',
share:'SHARE YOUR SCORE:',
resultTitle:'GAME OVER',
resultComplete:'COMPLETE',
resultDesc:'LEVEL [NUMBER]',
}
//Social share, [SCORE] will replace with game score
var shareEnable = true; //toggle share
var shareTitle = 'Highscore on Color Maze is Level [SCORE]';//social share score title
var shareMessage = 'Level [SCORE] is mine new highscore on Color Maze game! Try it now!'; //social share score message
The sound can be easily disabled to avoid compatibility issues in sound.js file:
var enableDesktopSound = true; //sound for dekstop
var enableMobileSound = true; //sound for mobile and tablet
Levels
You can easily customize levels in levelSettings in level.js file, it store level settings and below is the explanation of each most important objects:
var levelSettings = [
{
puzzle:[
[0,0,0,],
[0,1,0,],
[0,1,0,],
[0,1,0,],
[0,1,0,],
[0,1,0,],
[0,0,0,],
],
start:{
x:1,
y:1
}
}
]
puzzle- array of puzzle (0 = block, 1 = path)start- start positionx- position xy- position y
Built-in Editor
This is the section where you can edit the levels with the tool by running edit.html. The page start with edit tools, click generate button to export the array when you complete editing, replace the new array in levelSettings in level.js file.
1. Basic Options
- First select the viewport mode, then select the puzzle you want to edit.
- Option to add, remove and sort puzzles.
- This section is to edit puzzle, and also output the new array objects.
- Edit Puzzle - edit puzzle settings
- Test Play - test play the puzzle
- Generate Array - click to generate new Array, copy and replace into
levelSettingsinlevel.jsfor new update
2. Edit Puzzle
Click on the grid to switch between block or path.
- Enter the maze size
- Enter the ball start position
- Click update puzzle to update new maze and position, click done to go back main options.
HTML Structure
Structure used to design web pages including HTML structure, CSS Files, Javascript and more...
The page start with the loader wrapper that covering the whole screen in the body. It shows loader progress when calls the function initPreload()
<!-- PERCENT LOADER START-->
<div id="mainLoader"><img src="assets/loader.png" /><br><span>0</span></div>
<!-- PERCENT LOADER END-->
This section is for browser not support page when calls the function checkBrowser(). It shows error message when detect the browser does not support canvas.
<!-- BROWSER NOT SUPPORT START-->
<div id="notSupportHolder">
<div class="notSupport">YOUR BROWSER ISN'T SUPPORTED.<br/>PLEASE UPDATE YOUR BROWSER IN ORDER TO RUN THE GAME</div>
</div>
<!-- BROWSER NOT SUPPORT END-->
Follow by one canvas tag in the body. The game start initiatie by calls the main function of the game initMain().
<!-- CANVAS START-->
<div id="canvasHolder">
<canvas id="gameCanvas" width="1280" height="768"></canvas>
</div>
<!-- CANVAS END-->
CSS Files
We're using two CSS files in this game. The first one is normalize.css a generic reset file. Many browser interpret the default behavior of html elements differently. By using a general reset CSS file, we can work round this. This file also contains some general styling, such as anchor tag colors, font-sizes, etc. Keep in mind, that these values might be overridden somewhere else in the file.
The second file main.css contains all of the specific stylings for the canvas and some hack to be fully compatible with all most popular mobile device.
JavaScript
This game using Javascript files below.
-
jquery.min.js- is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML.
-
detectmobilebrowser.js- is a open source scripts to detect mobile browsers and phones.
-
createjs.min.js- is a suite of modular libraries and tools which work together to create interactive content on open web technologies via HTML5.
-
TweenMax.min.js- is an extremely fast, lightweight, and flexible animation tool that serves as the foundation of the GreenSock Animation Platform (GSAP).
-
js.cookie.js- is a simple, lightweight JavaScript API for handling cookies.
-
The game have the following js files
init.js- check if browser or device supportloader.js- loader to load all game imagesmain.js- initiate game setup and browser resize functionmobile.js- mobile orientation changecanvas.js- canvas setup and resizesound.js- sound eventedit.js- built-in editor tool functionlevel.js- level settingsgame.js- game play and logicsplugins.js- additonal useful plugins
Game Flow
- The
index.htmlfile startinit.jsfor browser detection - If browser is supported, init
loader.jsto start load asserts with loading progress - For mobile the rotate instruction shows when device is in portrait view, detect by
mobile.js - When all asserts contained in /assets folder are loaded, the game start construct
canvas.jsfrommain.jsthats shows game menu - If user click start button in game menu, the game will start with
game.js - If user swipe the screen or press arrow keyboard, the paintball will move and fill the path direction
- If user click undo button, it will undo to previous stroke
- If user fill the maze, the level will complete
- If user click the main button in game result, it will go to level page
Game Functions
The most important functions used for page.
- checkBrowser() This function is runs for browser detection
- checkMobileEvent() This function runs for mobile event
The most important functions used for game.
- initMain() This function build canvas
- startGame() This function start gameplay
- updateGame() This function manages the game loop
- stopGame() This function stop gameplay
- saveGame() This function save game score
Game Assets
You can edit the design files and easily reskin the game graphics.
The game contain /design folder which include following:
colormaze_1280x768.psd- with layer folders below- Option
- Result
- Gameplay
- Landing
The folder /game/assets contains all the images of the game that can be replaced. Is better to have the same size of the old ones if you want to reskin the game graphic without coding.
Compatibility
This game is build for Desktop browsers that support HTML5 canvas. Any mobile/tablet should work in landscape and portrait view, but they are not officially supported.
Add-ons
The add-on is an additional feature added to the game and it requires the base game in order to work, below are the add-ons that are compatible with this game:
This game is compatible with Scoreboard for HTML5 Games, it is a add-ons page where user can submit score and view top 10 leaderboard. You can get it here.
Source & Credits
Fonts:
- Multicolore from file Neogrey Creative
Images:
- N/A
Sounds:
- abstract (ambient loop) from file ShadyDave
- Fun & Relaxing Piano Music from file Migfus20
- System Notification #4 from file UNIVERSFIELD
- 01_bottle pop and fizz.wav from file helena.vp
Support
If this documentation doesn't answer your questions, you can send us email via Item Support Page
Here you can find plugin & other documentation that support this game.
- Wordpress Site - By using Scoreboard for HTML5 Games plugin, you can embed HTML5 game into WordPress post or page. Get the Plugin
- Ad Placeholder - Help simulate ads on HTML5 Games, you can integrate and display static and takeover ads through different Ads Serving Platform. Documentation
- Instant Games – Facebook - Guide you through integrating Facebook Instant Games API in our HTML5 Games. Documentation
Don’t forget to Rate this game
Go to your Codecanyon Profile > Downloads Tab > & then You can Rate & Review for our game.
Thank You.
Changelog
See what's new added, changed, fixed, improved or updated in the latest versions.
Version 1.0
Initial Release